#import "wooddoc.h"

@implementation WoodDoc (Closing)

- free
{
	[tree free];
	[undoManager free];
    NX_FREE(name);
    NX_FREE(directory);
	if([printInfo isKindOf:[DGPrintInfo class]])	
		[printInfo free];
    [NXApp reuseDocZone:[self zone]];
    return [super free];
}


- save
{
   NXTypedStream *stream;
    
   stream =  NXOpenTypedStreamForFile([self fileName],NX_WRITEONLY);
   if(stream != NULL){
        NXWriteRootObject(stream,tree);
		NXWriteObject(stream,printInfo);
        NXCloseTypedStream(stream);
		[undoManager emptyUndoManager];
		return self;
   }	
   return nil;
}

@end
